package com.listener;

import org.springframework.boot.ConfigurableBootstrapContext;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.SpringApplicationRunListener;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.ConfigurableEnvironment;

public class MySpringbootRunListener implements SpringApplicationRunListener {
    public MySpringbootRunListener(SpringApplication application, String args[]){
        System.out.println("MySpringbootRunListener init...." + application + ":" + args);

    }

    public void starting(ConfigurableBootstrapContext bootstrapContext) {
        System.out.println("starting....");
        this.starting();
    }

    @Deprecated
    public void starting() {
        System.out.println("starting");
    }

    public void environmentPrepared(ConfigurableBootstrapContext bootstrapContext, ConfigurableEnvironment environment) {
        this.environmentPrepared(environment);
        System.out.println("environmentPrepared");
    }

    /** @deprecated */
    @Deprecated
    public void environmentPrepared(ConfigurableEnvironment environment) {
        System.out.println("environmentPrepared");
    }

    public void contextPrepared(ConfigurableApplicationContext context) {
        System.out.println("contextPrepared");
    }

    public void contextLoaded(ConfigurableApplicationContext context) {
        System.out.println("contextLoaded");
    }

    public void started(ConfigurableApplicationContext context) {
        System.out.println("started");
    }

    public void running(ConfigurableApplicationContext context) {
        System.out.println("running");
    }

    public void failed(ConfigurableApplicationContext context, Throwable exception) {
        System.out.println("failed--------------");
    }
}
